<?php
include_once BASEPATH. "application/news/models/News.php";

class News_AdmnewsController extends Zend_Controller_Action
{

	public function init()
	{
		$this->request = $this->getRequest()->getParams();
	}

	public function indexAction()
	{
		$this->render();
	}

	public function listAction()
	{
		$news = new News();

		$this->_helper->viewRenderer->setNoRender();

        $this->getResponse()->setBody($news->getListJson());
	}

	public function editAction()
	{
		$news = new News();

		$this->view->news = $news->find($this->request["Id"]);
		$this->view->submit = "update";
		$this->render();
	}

	/*public function newAction(){{{*/
	/**
	 */
	public function newAction()
	{
		$news = new News();
		$row = $news->getDo()->fetchNew();
		$row->Date = date("Y-m-d H:i:s");

		$this->view->news = $row;
		$this->view->submit = "insert";
		$this->render("edit");
	}
	/*}}}*/


	/*public function insertAction(){{{*/
	/**
	 */
	public function insertAction()
	{
		$news = new News();

		$this->_helper->viewRenderer->setNoRender();

        $this->getResponse()->setBody($news->insert($this->request));
	}
	/*}}}*/

	/*public function updateAction(){{{*/
	/**
	 */
	public function updateAction()
	{
		$news = new News();

		$this->_helper->viewRenderer->setNoRender();

        $this->getResponse()->setBody($news->update($this->request));
	}
	/*}}}*/

	/*public function deleteAction(){{{*/
	/**
	 */
	public function deleteAction()
	{
		$news = new News();

		$this->_helper->viewRenderer->setNoRender();

        $this->getResponse()->setBody($news->delete($this->request['Id']));
	}
	/*}}}*/

}
?>
